import React from 'react';
import {Checkbox} from 'antd';
const CheckboxGroup = Checkbox.Group;
import {WeaSearchGroup, WeaFormItem} from 'ecCom';
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
import EType from './base/EType';
import ETitle from './base/ETitle';
import ELinkMode from './base/ELinkMode';

// 多岗位办理事项
export default class Content_jobsinfo extends React.Component {
    state = {
        eShowClassify: this.props.eShowClassify.checked
    };

    render() {
        const {eShowClassify} = this.state;

        let EShowClassify = <div></div>;
        if (this.props.eShareLevel == '2') {
            EShowClassify = (
                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@3ht2by`} label={getLabel(386590, '显示类别')} labelCol={{span: 6}} wrapperCol={{span: 16}}>
                    <CheckboxGroup ecId={`${this && this.props && this.props.ecId || ''}_CheckboxGroup@w0weql`} size="default" options={this.props.eShowClassify.options} value={eShowClassify} onChange={checkedValue => this.setState({eShowClassify: checkedValue})}/>
                </WeaFormItem>
            );
        }

        return (
            <div>
                <WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@ggafa3`} title={getLabel(81711, '基本信息')} needTigger={true} showGroup={true}>
                    <EType ecId={`${this && this.props && this.props.ecId || ''}_EType@3v2ldn`} ref="eType" value={this.props.eBaseName}/>
                    {this.props.eShareLevel == '2' ? <ETitle ecId={`${this && this.props && this.props.ecId || ''}_ETitle@xbq2bt`} ref="eTitle" eid={this.props.eid} value={this.props.eTitle} {...this.props}/> : ''}
                    <ELinkMode ecId={`${this && this.props && this.props.ecId || ''}_ELinkMode@s1vicl`} ref="eLinkMode" options={this.props.eLinkMode.options} value={this.props.eLinkMode.selected}/>
                    {EShowClassify}
                </WeaSearchGroup>
            </div>
        );
    }

    getSaveValues() {
        return {
            eContentTitle: this.refs['eTitle'] ? this.refs['eTitle'].getSaveValues() : this.props.eTitle,
            eContentLinkMode: this.refs['eLinkMode'].getSaveValues(),
            eContentShowClassify: this.state.eShowClassify
        };
    }
}